package com.zjm.servlet.servlet02_lifecycle;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author ZJM
 * @date 2024/4/10 23:37
 * Servlet生命周期
 */
public class LifecycleServlet implements Servlet {

    public LifecycleServlet() {
        System.out.println("1.构造方法");
    }

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("2.初始化");
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("3.service");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("4.destroy销毁");
    }
}
